package fr.afcepf.ticketing.dao;

import java.util.Collection;

import javax.annotation.PostConstruct;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import fr.afcepf.ticketing.domain.Ticket;

@Stateless
@Local
public class TicketDaoJpa extends GenericDaoJpa<Ticket,Long> implements TicketDao {
	
	@PersistenceContext 
	private EntityManager em;
	
	@PostConstruct
	public void initEntityManagerOfGenericDaoJpa(){
		super.setEntityManager(em);
	}
	
	@Override
	public Collection<Ticket> allTickets(long id) {
		return em.createQuery("select t1 from Ticket as t1 where t1.type="+id).getResultList();
	}
		

}
